package com.ruoyi.quartz.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quartz.mapper.YongyouCgfpMapper;
import com.ruoyi.quartz.domain.YongyouCgfp;
import com.ruoyi.quartz.service.IYongyouCgfpService;

/**
 * 采购发票Service业务层处理
 * 
 * @author SYF
 * @date 2025-04-17
 */
@Service
public class YongyouCgfpServiceImpl implements IYongyouCgfpService 
{
    @Autowired
    private YongyouCgfpMapper yongyouCgfpMapper;

    /**
     * 查询采购发票
     * 
     * @param vouchdate 采购发票主键
     * @return 采购发票
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public YongyouCgfp selectYongyouCgfpByVouchdate(String vouchdate)
    {
        return yongyouCgfpMapper.selectYongyouCgfpByVouchdate(vouchdate);
    }

    /**
     * 查询采购发票列表
     * 
     * @param yongyouCgfp 采购发票
     * @return 采购发票
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public List<YongyouCgfp> selectYongyouCgfpList(YongyouCgfp yongyouCgfp)
    {
        return yongyouCgfpMapper.selectYongyouCgfpList(yongyouCgfp);
    }

    /**
     * 新增采购发票
     * 
     * @param yongyouCgfp 采购发票
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int insertYongyouCgfp(YongyouCgfp yongyouCgfp)
    {
        return yongyouCgfpMapper.insertYongyouCgfp(yongyouCgfp);
    }

    /**
     * 修改采购发票
     * 
     * @param yongyouCgfp 采购发票
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int updateYongyouCgfp(YongyouCgfp yongyouCgfp)
    {
        return yongyouCgfpMapper.updateYongyouCgfp(yongyouCgfp);
    }

    /**
     * 批量删除采购发票
     * 
     * @param vouchdates 需要删除的采购发票主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgfpByVouchdates(String[] vouchdates)
    {
        return yongyouCgfpMapper.deleteYongyouCgfpByVouchdates(vouchdates);
    }

    /**
     * 删除采购发票信息
     * 
     * @param vouchdate 采购发票主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgfpByVouchdate(String vouchdate)
    {
        return yongyouCgfpMapper.deleteYongyouCgfpByVouchdate(vouchdate);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteYongyouCgfpByDate(String vouchdate)
    {
        return yongyouCgfpMapper.deleteYongyouCgfpByDate(vouchdate);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public int clearCgfp(){
        return yongyouCgfpMapper.clearCgfp();
    }
}
